package com.haruhinav.controller.admin;

import com.haruhinav.entity.DefaultFace;
import com.haruhinav.entity.extend.DefaultFaceEX;
import com.haruhinav.entity.vo.ResultVO;
import com.haruhinav.service.DefaultFaceService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/admin/dface")
public class AdminDefaultFaceController {

    @Resource
    private DefaultFaceService defaultFaceService;

    //    所有默认头像
    @PostMapping("/y/list")
    public ResultVO queryDefaultFace(@RequestBody DefaultFaceEX defaultFaceEx){
        return defaultFaceService.queryDefaultFaceLimit(defaultFaceEx);
    }

    @PostMapping("/y/insert")
    public ResultVO insertDFace(@RequestBody DefaultFace defaultFace){
        return defaultFaceService.insertDefaultFace(defaultFace);
    }
    @GetMapping("/y/one/{id}")
    public DefaultFace getOneDFace(@PathVariable("id") Integer id){
        return defaultFaceService.findDFaceById(id);
    }
    @PostMapping("/y/remove")
    public ResultVO delDFace(@RequestBody DefaultFace defaultFace){
        return defaultFaceService.delDFaceById(defaultFace.getId());
    }
    @PostMapping("/y/update")
    public ResultVO updateDFace(@RequestBody DefaultFace defaultFace){
        return defaultFaceService.updateDFace(defaultFace.getUrl(),defaultFace.getId());
    }
}
